import { NButton, NCascader, NInput, NInputNumber, NRadio, NTag } from 'naive-ui';
// 需要动态修改size 的组件
const components = [NButton, NTag, NInput, NInputNumber, NRadio, NCascader];
export const setupNaiveUi = () => {
  import('@/store/modules/theme.js').then((res) => {
    const { useThemeStore = () => null } = res;
    const themeStore = useThemeStore();
    components.forEach((component) => {
      Object.assign(component.props, {
        size: {
          default: () => themeStore.componentSize,
        },
      });
    });
    // 统一vxeTable size 和 naiveUI 的size
    const size = themeStore.componentSize;
    $VXETable.setup({
      size: /^(tiny|small|medium)$/.test(size) ? (size === 'tiny' ? 'mini' : size) : '',
    });
  });
};
